package com.zking.ssm.PMQ.controller;

import com.zking.ssm.PMQ.model.Role;
import com.zking.ssm.PMQ.service.IRoleService;
import com.zking.ssm.util.JsonData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/Role")
public class RoleController {

    @Autowired
    private IRoleService roleService;

    private JsonData jsonData = new JsonData();

    public RoleController() {
    }

    @RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
   public JsonData listRole(Role role){
        System.out.println("来了老弟");
       List<Role> list = roleService.listRole(role);
        jsonData.setCode(0);
        jsonData.setMessage("查询成功");
        jsonData.setResult(list);
        System.out.println("hh");
        return jsonData;
   }
}
